package com.aabte.design2.creational.builder;

/**
 * 生成器与其他创建型模式的不同之处在于：它让你能创建不遵循相同接口的产品。
 *
 * @author Daniel
 * @version 1.0
 * @date 2020/5/2
 */
public class CarManualBuilder implements Builder {
    private Manual manual;

    public static Builder builder() {
        CarManualBuilder builder = new CarManualBuilder();
        builder.reset();
        return builder;
    }

    @Override
    public Manual build() {
        Manual manual = this.manual;
        this.reset();
        return manual;
    }

    @Override
    public void reset() {
        this.manual = new Manual();
    }

    @Override
    public void seats(int number) {
        manual.setSeats(number);
    }

    @Override
    public void engine(Engine engine) {
        manual.setEngine(engine);
    }

    @Override
    public void tripComputer(boolean flag) {
        manual.setTripComputer(flag);
    }

    @Override
    public void GPS(boolean flag) {
        manual.setGPS(flag);
    }
}
